Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/deseng695: Updated Who is Listening Widget, changed colour of Video Widget overlay logo, fixed media query for Map Widget expand link. #2598

Merged
merged 5 commits into from
Oct 3, 2024

Conversation

jareth-whitney
Copy link
Contributor

Issue #: https://citz-gdx.atlassian.net/browse/DESENG-695
Issue #: https://citz-gdx.atlassian.net/browse/DESENG-692
Issue #: https://citz-gdx.atlassian.net/browse/DESENG-693

Description of changes:

  • New Who is Listening widget front end

    • Implemented Figma design
    • Added widget_listening table to db for widget instance data
    • Added option to enter widget description text (below title, above contacts)
    • Adjusted CSS to accomodate multiple viewports
    • Added ARIA labels for accessibility
    • Updated contact create/edit form
  • Video Widget

    • Changed icon colour from yellow to white to accomodate company branding requests
  • Map Widget

    • Adjusted viewport settings of expand map link to accomodate breakpoints of engagement view page

User Guide update ticket (if applicable):
N/A

@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 69.23077% with 28 lines in your changes missing coverage. Please review.

Project coverage is 75.13%. Comparing base (0b61f80) to head (bd97069).

Files with missing lines Patch % Lines
.../services/widgetService/ListeningService/index.tsx 43.47% 13 Missing ⚠️
...ementWidgets/WhoIsListening/WhoIsListeningForm.tsx 30.00% 7 Missing ⚠️
...ntWidgets/WhoIsListening/WhoIsListeningContext.tsx 76.19% 5 Missing ⚠️
...gagement/old-view/widgets/WhoIsListeningWidget.tsx 94.44% 2 Missing ⚠️
...ents/engagement/old-view/widgets/Map/MapWidget.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2598      +/-   ##
==========================================
- Coverage   75.17%   75.13%   -0.04%     
==========================================
  Files         612      613       +1     
  Lines       22224    22308      +84     
  Branches     1866     1882      +16     
==========================================
+ Hits        16706    16762      +56     
- Misses       5247     5275      +28     
  Partials      271      271              
Flag Coverage Δ
metweb 64.24% <69.23%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
met-api/src/met_api/models/__init__.py 100.00% <ø> (ø)
met-api/src/met_api/models/widget_translation.py 98.00% <ø> (ø)
met-api/src/met_api/resources/__init__.py 100.00% <ø> (ø)
met-api/src/met_api/schemas/widget_translation.py 100.00% <ø> (ø)
...src/met_api/services/widget_translation_service.py 76.47% <ø> (ø)
met-web/src/apiManager/endpoints/index.ts 100.00% <ø> (ø)
...agementWidgets/WhoIsListening/AddContactDrawer.tsx 54.11% <ø> (ø)
...agementWidgets/WhoIsListening/ContactInfoPaper.tsx 76.47% <ø> (ø)
...agement/old-view/widgets/Video/VideoWidgetView.tsx 19.04% <ø> (ø)
met-web/src/components/imageUpload/index.tsx 95.00% <ø> (-5.00%) ⬇️
... and 5 more

Copy link
Collaborator

@Baelx Baelx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jareth! Looks good, could you please review all my comments. To proceed, could you:

  • Remove the empty labels on form controls (see my comment) or, even better, link MetLabels to form controls
  • See my comment about the widget listening context, just curious about this approach for this

sa.ForeignKeyConstraint(['widget_id'], ['widget.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.add_column('widget_translation', sa.Column('listening_description', sa.Text(), nullable=True))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for remembering the translation for it!


@cors_preflight('GET, POST')
@API.route('')
class Listenings(Resource):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂 the name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, it reminds me of a horror movie. "The Listening".

fake = Faker()


def test_create_listening_widget(client, jwt, session,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a few tests here! Our coverage has been slowly slipping as we add a bunch of huge new features

data-testid="contact-form/phone"
aria-label="Phone: optional."
variant="outlined"
label=" "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the accessibility here. I'd recommend removing this empty label in case it causes confusion.

const [addedContacts, setAddedContacts] = useState<Contact[]>([]);
const [loadingContacts, setLoadingContacts] = useState(true);

if (!widget) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious about this part - why did we need to check if there was no widget and then return a different context provider?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The widget is passed down as a prop, and if it's missing, it just displays a blank widget. That's the way it was designed before. We could change it if needed. I have moved the useEffect to the top of the component to avoid the errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm what we discussed over Teams, it's a useContext, not a prop, that it's passed down from. I know that I didn't create this code, but I couldn't find it on main, so I removed it, made some additional conditions, and tested again. I'm having no errors or issues now, so this code has been removed.

setListeningWidget({ ...listeningWidget, description: e.target.value });
}}
label=" "
aria-label="Description: optional."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to change things now, but in the future I'd advise that we use the actual label. If you have multiple elements that label a control, you can use aria-labelledby="id1 id2" where the IDs correspond to each labelling element. From WCAG: "Whenever possible, use the label element to associate text with form elements explicitly."

https://www.w3.org/WAI/tutorials/forms/labels/

setIsLoading(false);
} catch (error) {
setIsLoading(false);
console.log(error);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though we may retire this code at some point soon, I'd still recommend you use console.error and give the log a descriptive label to help us locate it in the code if we're troubleshooting.

Suggested change
console.log(error);
console.error('Error loading who is listening widget.', error);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry, that was just for my benefit, it's been removed.

<Grid container justifyContent={{ xs: 'center', md: 'flex-start' }} item xs={12}>
<BodyText>{contact.title}</BodyText>
<Grid justifyContent={{ xs: 'center', md: 'flex-start' }} xs={12}>
<BodyText sx={contactTitleStyles} aria-label="Contact job title:">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm not necessarily against this but just curious on why you added the aria label? Is it clear to sighted users that this is a job title, but not to non-sighted users?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it depends how you think it should be read. To me, it should be like name: John Smith, contact job title: minister of mining, etc. But it could also just read the fields, like John Smith, Minister of Mining.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to the shorter way.

Copy link

sonarcloud bot commented Oct 3, 2024

Copy link
Collaborator

@Baelx Baelx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes! Approved

@jareth-whitney jareth-whitney merged commit bb89f8d into main Oct 3, 2024
12 of 15 checks passed
@jareth-whitney jareth-whitney deleted the feature/deseng695 branch October 3, 2024 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants